<div class="content">
	<form class="form-horizontal" name="teamForm" ng-submit="vm.submitForm(teamForm.$valid)" novalidate>
		<div class="ibox">
	        <div class="ibox-title">
	            <h5>团队信息</h5>
	        </div>
	        <div class="ibox-content">
                <div class="form-group">
                    <label class="col-lg-3 control-label">所属科目 <b class="text-danger">*</b></label>
                    <div class="col-lg-3">
                        <select name="course" class="form-control" ng-model="vm.team.course" ng-options="item.course_name for item in vm.courselist" ng-disabled="vm.runnerlist.length!=0" required>  
                            <option value="">请选择科目</option>  
                        </select>
                    </div>
                </div>
                <div class="form-group" ng-if="vm.runnerlist.length!=0">
                    <div class="col-lg-offset-3 col-lg-6">
                        <p class="help-block text-danger">无法更改科目，因为已经有下列选手归属于<span>{{vm.team.course.course_name}}</span>，并参加了这个团队。如需更改，请先 <a ui-sref="dashboard.race.runnerlist" style="text-decoration: underline">更改选手所属科目</a>。</p>
                    </div>
                </div>
	            <div class="form-group">
                    <label class="col-lg-3 control-label">团队名称 <b class="text-danger">*</b></label>
                    <div class="col-lg-3">
                        <input type="text" name="teamName" class="form-control" placeholder="请输入团队名称" ng-model="vm.team.team_name" required>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg-3 control-label">团队性别 <b class="text-danger">*</b></label>
                    <div class="col-lg-3">
                        <select name="teamGender" class="form-control" ng-model="vm.team.team_gender" ng-options="item.text for item in vm.team_gender" required>  
                            <option value="">请选择团队性别</option>  
                        </select>
                    </div>
                </div>
                
                <div class="form-group" ng-if="vm.runnerlist.length>0">
                    <label class="col-lg-3 control-label">团队选手</label>
                    <div class="col-lg-9">
                        <table class="table table-striped table-bordered table-hover">
                            <thead>
                                <tr>
                                    <th class="text-center">选手号</th>
                                    <th class="text-center">姓名</th>
                                    <th class="text-center">性别</th>
                                    <th class="text-center">手机号码</th>
                                    <th class="text-center">身份证</th>
                                    <th class="text-center">邮箱</th>
                                    <th class="text-center">地址</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr ng-repeat="runner in vm.runnerlist">
                                    <td class="text-center">{{runner.bib}}</td>
                                    <td class="text-center">{{runner.runner_name}}</td>
                                    <td class="text-center">
                                        {{runner.runner_gender ? (runner.runner_gender == 'unknown' ? '未知' : (runner.runner_gender == 'male' ? '男' : '女')) : '未知'}}
                                    </td>
                                    <td class="text-center">{{runner.runner_cell}}</td>
                                    <td class="text-center">{{runner.identity}}</td>
                                    <td class="text-center">{{runner.runner_mail}}</td>
                                    <td class="text-center">{{runner.address}}</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-lg-offset-3 col-lg-3">
                        <button type="button" class="btn btn-sm btn-default" ui-sref="dashboard.race.teamlist"><i class="fa fa-times"></i>取消</button>
                        <button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-save"></i>保存</button>
                        <button type="button" class="btn btn-sm btn-danger" ng-click="vm.deleteItems($state.params.team_id)" ng-if="$state.params.team_id"><i class="fa fa-trash-o"></i>删除</button>
                    </div>
                </div>
	        </div>
	    </div>
	</form>
</div>